/**
 * 车辆基本信息
 *
 */
var express = require('express');
var request = require('request');

var url = require('url');
var qstr = require("querystring");
var multiparty = require('multiparty');
var util = require('util');
var fs = require("fs");
var pro = require('../../property/cuspro');
var auth = require('../../auth/auth');
var util = require('../../util/commonutil');
var multer  = require('multer');
var storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, 'public/uploads/');
    },
    filename: function (req, file, cb) {
        var fname=file.originalname;
        var pixs="";
        if(fname){
            pixs=fname.split(".")[1];
        }
        cb(null,  file.fieldname + '-' + Date.now()+"."+pixs);
    }
})

var upload = multer({ storage: storage });

var router = express.Router();
// var querystring = require('querystring');

//dept
router.post('/imgFile', upload.single('file'), function (req, res, next) {
    var file = req.file;
    console.log('文件类型：%s', file.mimetype);
    console.log('原始文件名：%s', file.originalname);
    console.log('文件大小：%s', file.size);
    console.log('文件保存路径：%s', file.path);
    res.json("export successfully!");
});

module.exports = router;
